cmake_minimum_required(VERSION 3.17)
project(Foreach)

foreach(num RANGE 3)
	message(STATUS "num = ${num}")
endforeach()

message(STATUS "=====")
foreach(num RANGE 3 12 3)
	message(STATUS "num = ${num}")
endforeach()

message(STATUS "=====")
set(A 2;5)
set(B 1 2 3)
set(C "1 2 3")
set(D 5;8 9)
set(E "")
foreach(x IN LISTS A B C D E)
	message(STATUS "x = ${x}")
endforeach()

message(STATUS "=====")
foreach(b IN LISTS B)
	message(STATUS "b = ${b}")
endforeach()

message(STATUS "=====")
foreach(b IN ITEMS ${B})
	message(STATUS "b = ${b}")
endforeach()

message(STATUS "=====")
set(A 5;10;15)
set(B a b c)
set(C 100;200;300)
foreach(pair IN ZIP_LISTS A B)
	message(STATUS "pair_0 = ${pair_0}, pair_1 = ${pair_1}")
endforeach()

message(STATUS "=====")
foreach(aa bb cc IN ZIP_LISTS A B C)
	message(STATUS "aa = ${aa}, bb = ${bb}, cc = ${cc}")
endforeach()
